package cn.cheln.explorer.func.setup;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.*;

import com.umeng.analytics.MobclickAgent;

/**
 * Created by Administrator on 13-10-20.
 */
public class PackageInstallService extends Service {

    @Override
    public void onStart(Intent intent, int startId) {
        super.onStart(intent, startId);
        context = this;
        try {
            PackageInstallManager installManager = PackageInstallManager.getInstance();

            installManager.beginAllInstall(installManager.notifyUtil, installManager.paths.size(), installManager.intallingAppLabel,this);
            MobclickAgent.onError(this);

//setForeground(true);
//            String contin = intent.getStringExtra("continue");
//            Logs.e("=== "+contin);
//            if(contin!=null){
//                PackageInstallManager installManager = PackageInstallManager.getInstance();
//                installManager.tryNextInstall(installManager.recentLabel, installManager.currentTextShow, installManager.currentSuccess);
//                return;
//            }

            PackageInstallManager.getInstance().beginInstall(PackageInstallManager.toInstallPaths);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
public static Context context;
    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

//    @Override
//    public int onStartCommand(Intent intent, int flags, int startId) {
//        return START_STICKY;
//    }
}
